package javaVersion.learn.streamProcess;

import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;


public class Pro1_CollectSource {

    public static void main(String[] args) throws Exception {
        // TODO: 2020/7/17 创建流处理环境
        StreamExecutionEnvironment senv = StreamExecutionEnvironment.getExecutionEnvironment();
        //设置并行度
        senv.setParallelism(1);

        // TODO: 2020/7/17 指定数据源,加载本地集合
        DataStreamSource<Integer> source = senv.fromElements(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);

        // TODO: 2020/7/17 打印数据
        source.print();

        // TODO: 2020/7/17 执行任务,在批处理时,print可以触发任务执行,但在流环境下,必须手动执行任务
        senv.execute();

    }
}
